bitkeeper revision 1.825.4.2 (4063fcebXyP3T4ohTINdoE1EnVdbIA)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 26 Mar 2004 09:50:35 +0000 (09:50 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Fri, 26 Mar 2004 09:50:35 +0000 (09:50 +0000)
time.c, setup.c:
  Fix time handling after suspend/resume cycle.

xenolinux-2.4.25-sparse/arch/xen/kernel/setup.c
xenolinux-2.4.25-sparse/arch/xen/kernel/time.c

index ad4a2fea4afa77ad5ff6fc87c858f12616e12493..bce8d394970a4eada708941cbcaa2468d95f792c 100644 (file)
@@ -1151,6 +1151,9 @@ static void stop_task(void *unused)
     extern void blkdev_suspend(void);
     extern void blkdev_resume(void);
     
+    extern void time_suspend(void);
+    extern void time_resume(void);
+
     unsigned long *pfn_to_mfn_frame_list = NULL;
     suspend_record_t *suspend_record     = NULL;
     struct net_device *dev;
@@ -1198,6 +1201,8 @@ static void stop_task(void *unused)
 
     __cli();
 
+    time_suspend();
+
     HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
     clear_fixmap(FIX_SHARED_INFO);
 
@@ -1211,6 +1216,8 @@ static void stop_task(void *unused)
     HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
     memset(empty_zero_page, 0, PAGE_SIZE);
 
+    time_resume();
+
     __sti();
 
     blkdev_resume();
index 663fdf2badfb043a7b6a0527050f3de3a1383427..1404fbdb2bc77258aa6aa8f371a7e3b9ec4d9248 100644 (file)
@@ -634,6 +634,24 @@ void __init time_init(void)
     rdtscll(alarm);
 }
 
+void time_suspend(void)
+{
+}
+
+void time_resume(void)
+{
+    unsigned long flags;
+    write_lock_irqsave(&xtime_lock, flags);
+    /* Get timebases for new environment. */ 
+    __get_time_values_from_xen();
+    /* Reset our own concept of passage of system time. */
+    processed_system_time = shadow_system_time;
+    /* Accept a warp in UTC (wall-clock) time. */
+    last_seen_tv.tv_sec = 0;
+    /* Make sure we resync UTC time with Xen on next timer interrupt. */
+    last_update_from_xen = 0;
+    write_unlock_irqrestore(&xtime_lock, flags);
+}
 
 /*
  * /proc/sys/xen: This really belongs in another file. It can stay here for